Image processing

ABSTRACT

A method of aligning a first image with a second image, the method comprising the steps of; approximately locating the second image; scaling the first image to the approximate size of the second image; positioning the scaled first image over the approximate location of the second image; generating a measure of fit between the first image and the second image; re-positioning the second image and repeating the above steps to obtain an increased measure of fit value. A method of synchronising a first sequence of images with a second sequence of images, the method comprising the steps of; creating a first index pointer identifying an image in the first sequence of images; creating a second index pointer identifying an image in the second sequence of images; comparing the image identified by the first index pointer with the image identified by the second index pointer; incrementing the first index pointer to identify the subsequent image in the first sequence of images; and repeating the above steps until the image identified by the first index pointer matches the image identified by the second index pointer.

[0001] This invention relates to the field of image processing, and in particular the processing of video sequences.

[0002] Digital video systems rely on the imperfections of human vision and perception to render a video sequence by transmitting a decreased amount of information. As a result the subjective quality of a digital video system can be difficult to predict, because it is unrelated to the objective degradation present in the rendered video sequence. At present, the only reliable method by which the subjective video quality can be assessed is to run subjective tests, where a number of people give their opinion regarding the quality of an observed video sequence. Subjective testing is expensive and time consuming, and additionally not suitable for all applications, for example real time assessment of service quality.

[0003] Furthermore, most objective models to assess the quality of digital video systems are designed to compare systems constrained by broadcast standards. This makes it easier to realign the two video streams as the degraded sequence has the same characteristics as the original sequence in terms of frame rate, frame size and the position of the frame within a restricted search window. If an objective model has to assess the quality of digital video systems in multimedia applications, different variables will have an effect and will need to be accounted for. For example, there is no indication about the image standard that can be expected at the output of the system to be tested: while the original sequence could be in a broadcast format, the degraded sequence might be CIF, QCIF, or any frame size and/or resolution chosen by the user of a multimedia application. Furthermore, the degraded sequence is likely to be presented in a software window, which could be located anywhere on a computer screen, with the user having control over the size and aspect ratio of the window.

[0004] One application that is commercially available at present, the Tektronix implementation of the JNDmetrix model, has solved this problem with the introduction of a calibration signal, which contains time stamp information. Though very reliable, this technique is invasive, because the time stamp adds some visual features and an important amount of movement to the sequence being tested. The timestamp is visible across the screen, which excludes the use of the system in any real time assessment of video services. Also, it can be argued that as the system has an influence on the image content it therefore affects the performance of the video system under test.

[0005] According to a first aspect of the invention there is provided a method of aligning a first image with a second image, the method comprising the steps of;

[0006] (i) approximately locating the second image;

[0007] (ii) scaling the first image to the approximate size of the second image;

[0008] (iii) positioning the scaled first image over the approximate location of the second image;

[0009] (iv) generating a measure of fit between the first image and the second image;

[0010] (v) re-positioning the second image;

[0011] and repeating steps (iv) and (v) to obtain an increased measure of fit value.

[0012] Preferably, step (iv) and step (v) are repeated until a threshold measure of fit value is obtained.

[0013] Alternatively, steps (iii), (iv) & (v) are replaced by:

[0014] (a) reducing the size of the first image to a size smaller than the approximate size of the second window;

[0015] (b) positioning the reduced first image within the approximate location of the second image;

[0016] (c) generating a measure of fit between the reduced first image and the second image;

[0017] (d) moving the reduced first image to a further position within the approximate location of the second image;

[0018] steps (c) and (d) being repeated to obtain an increased measure of fit value. Steps (c) and (d) may be repeated to generate a maximum measure of fit value for that first image size. If the maximum measure of fit value for that first image size does not reach a threshold measure of fit value then the first image may be further reduced in size and the maximum measure of fit value generated for that further reduced size.

[0019] According to a second aspect of the invention there is provided a method of synchronising a first sequence of images with a second sequence of images, the method comprising the steps of;

[0020] (a) creating a first index pointer identifying an image in the first sequence of images;

[0021] (b) creating a second index pointer identifying an image in the second sequence of images;

[0022] (c) comparing the image identified by the first index pointer with the image identified by the second index pointer;

[0023] (d) incrementing the first index pointer to identify the subsequent image in the first sequence of images; and

[0024] (e) repeating steps (c) and (d) until the image identified by the first index pointer matches the image identified by the second index pointer.

[0025] The invention also provides a method of aligning both spatially and temporally a first video sequence with a second video sequence, wherein the spatial alignment is as described above and the temporal alignment is as described above

[0026] Systems embodying the present invention will now be described in further detail, by way of example only, with reference to the accompanying drawings, in which:

[0027]FIG. 1 is a flowchart describing a method according to the present invention of aligning two video sequences;

[0028]FIG. 2 is a flowchart describing a method according to the present invention of spatially aligning two video sequences; and

[0029]FIG. 3 is a flowchart describing a method according to the present invention of temporally aligning two video sequences;

[0030] The visual comparison model of interest is a tool to assess the performances of digital video systems (see WO 97/32428 and MP Hollier et al, “Multi-modal perception”, BTTJ, vol. 17, no. 1, January 1999). By analysing the differences between the reference, or original sequence, and the processed, or degraded sequence, the visual comparison model is able to make a prediction of the subjective impact the errors will have on the user. The model is meant to work with both broadcast video quality, and computer or multimedia applications.

[0031] One of the aspects that can greatly decrease the performance of such a visual comparison model is the lack of synchronisation and alignment between the two sequences being compared. For instance, a slight delay or a displacement of a few pixels between the degraded sequence and the reference sequence would lead the model to detect a large number of errors, though these would not be perceived by an observer. As a slight spatial delay (typically of a few pixels) and a temporal delay are likely to be found at the output of any codec system. An initial pre-processing of the degraded sequence to align it to the reference sequence is necessary before a comparison model can be used to analyse the two sequences. Because they are most often research prototypes, test models present in the literature (see for example, AS Karunasekera & NG Kingsbury, “A Distortion Measure for Blocking Artifacts in Images Based on Human Visual Sensitivity”, IEEE Transactions On Image Processing, vol. 4, No. 6, June 1995 and KT Tan et al, “A video distortion meter”, Picture Coding Symposium, Berlin September 1997) do not account for this problem. The original sequence and the degraded sequence are assumed to be already spatially and temporally aligned, presumably by some form of manual intervention.

[0032] One aspect of the visual comparison model is to work by matching perceptual features present in the both sequences (see Hollier et al, op cit.). Because of this property, it is possible to consider that the initial synchronisation steps are unnecessary. Nevertheless, any comparison operation is done within a search window, and the processing cost and risk of making a comparison error increases significantly with the size of the search window. Furthermore, and because of the large number of sequence types a visual comparison model is likely to work with, the synchronisation information will involve more variables than previous models. For example, the image could be re-sized or re-scaled. It is therefore necessary for practical reasons to obtain a first estimate of the synchronisation between the original sequence and the degraded sequence, as well as the alterations that may have occurred.

[0033] The alterations that the image sequence is likely to have endured may include:

[0034] Horizontal displacement. In broadcast conditions, this synchronisation problem is quite likely. It is caused by delay in the transmission channel, as well as by synchronisation problems with the digital-to-analogue converter (DAC).

[0035] Vertical displacement. This is rare in an analogue broadcast system, where the position of the picture within the video frame is constrained by the broadcast standard. However, this aspect is not controlled in a multimedia application, where the sequence can be displayed where the user wants it, with the user controlling the position of the video application window.

[0036] Time delay. This will be present whenever video codec (coder-decoder) systems are used in a transmission channel. Its value can vary according to the type of codec or algorithm in used. Typically, systems such as H263, designed for videoconference applications have a short delay (about a second), to prevent discomfort occurring during conversation. Broadcast systems can have a longer time delay to allow the system more processing time.

[0037] Randomised time delay characteristics. Most network applications will sequence a digital video sequence into a stream of packets, with each of them taking a different amount of time to be transmitted across a network. It is possible that the frames may arrive out of sequence. The delay between the degraded sequence and the reference sequence is therefore likely to vary throughout the duration of the sequences.

[0038] Missing frames. This phenomenon occurs frequently as the compression rates are increased. For example, a common standard for good quality digital video applications is 15 frames per seconds [i.e. half the frame rate of the standard NTSC signal]. For most codecs and encoding algorithms the frame rate can vary in time, decreasing if the amount of movement in the video sequence is increasing. This may result in a random correspondence between the frame present in the original sequence and its match in the degraded sequence.

[0039] X and Y size. The position of the image within the video frame is fixed in broadcast standards, but this parameter can be chosen (and varied) by the user in multimedia applications.

[0040] To address these problems, a synchronisation method uses the information already present in the video frames to synchronise the two streams. To achieve this, it compares both streams in order to match each frame present in the degraded sequence with a frame present in the original sequence. Because of the size of the problem space to be searched, synchronising and aligning a video sequence present on a computer screen is a huge computational problem in itself. As the synchronisation process is merely the prelude to the use of the visual comparison model, it is not feasible to be searching for all of the synchronisation parameters all time

[0041] It should be noted that in order for a visual comparison model to function effectively it is necessary that each of the synchronisation parameters are accurate all of the time. Also, some of these parameters will not vary, or will vary at a low rate, with time, for example the position and/or size of the degraded sequence will not vary in a broadcast application and in a multimedia context will only change when the user is modifies the output window. Thus it is most effective to spatially synchronise the sequences initially and then search constantly to determine the temporal synchronisation of the sequences (i.e. what is the delay in propagation and are frames missing).

[0042] The proposed synchronisation algorithm is shown in flowchart form in FIGS. 1-3 and described below.

[0043] For the initial stages of synchronisation and during the spatial matching of the sequences a calibration signal (which provides a constant pattern) can be used, making the search easier and hence quicker. If the video comparison model is to be used to assess the quality of a system which is in use then clearly this is not an option and the video sequence in use must be matched.

[0044] Referring to FIG. 1, the first step 210 is to gain an approximate location and size of the window containing the degraded sequence of interest. This search window approximation may be provided by the user ‘lassoing’ the degraded sequence window using a mouse or by using a system call that provides information regarding the window position for a given thread (for example the Windows functions GetViewportExt and GetWindowOrigin from CSize structure). As a default the approximation can be taken to be the entire screen area, although this will increase the time taken to perform the later steps needed to match the sequences spatially if the window is significantly smaller than the entire screen area. If the degraded video sequence is in a broadcast application then this default approximation is more reliable.

[0045] Once the approximation has been made, the original video sequence must be changed to the approximate size and shape of the degraded video sequence (see step 220) so that it is possible to compare the two video sequences. The rescaled original sequence is placed within the approximated search window (step 230) and the spatial matching algorithm is used (step 240) to determine the optimum spatial match between the sequences (see FIG. 2 and description below). Once the two sequences have been successfully matched spatially then it is possible to begin the temporal matching process (step 260 and FIG. 3).

[0046] The flow chart for the spatial matching process is shown in FIG. 2. Each video sequence comprises a number of pixels, which can be regarded as forming a matrix, for example the original sequence can be considered to comprise a matrix O having i columns and j rows and the degraded sequence to comprise a matrix D having p columns and q rows. The first iteration of the comparison is performed by calculating the distance between the pixel from the original sequence and the corresponding pixel from the degraded sequence. The pixel distance parameter is calculated for each of the entries in the two matrices e.g. by comparing O(1, 1) with D(1, 1), O(1, 2) with D(1, 2), etc. for all values of i, j, p & q. If the two matrices do not have equal dimensions (i.e. if i≠p or j≠q) then dummy entries having zero values are created for the smaller matrix so that all of the matrix entries of the larger matrix can be compared. All of the difference calculation results are summed to give a measure of the difference between the original sequence and the degraded sequence for that iteration. A second iteration is then calculated, with an offset of one row (or alternatively one column) being introduced into one of the matrices: for example comparing O(1, 1) with D(1, 2), O(1, 2) with D(1, 3) up to O(1,j) with D(1,1) (and similarly for the other columns of the matrix). Alternatively O(1, 1) can be compared with D(2, 1), 0(2, 1) with D(3, 1) up to O(i,1) with D(1,1) (and similarly for the other rows of the matrix). The iterations are concluded until all of the possible combinations have been exhausted i.e. a total of (i−1) column shifts and (j−1) row shifts to give i+j−2 different comparison measures. The pixel distance is defined by

Distance={square root}{square root over ((deltaL)²+(deltaS)²+(deltaH)²)}

[0047] where deltaL is the difference between the luminance of the original pixel and the luminance of the degraded pixel, deltaS is the difference between the colour saturation of the original pixel and the colour saturation of the degraded pixel and deltaH is the difference between the hue of the original pixel and the hue of the degraded pixel. Whilst deltaL and deltaS may be calculated by a simple subtraction, due to the rotational nature of the hue value, deltaH is given by the minimum of [(H_(original)−H_(degraded));(256−H_(original)+H_(degraded))] {all values of H, L & S lying between 0 and 255. The conversion of RGB data to HSL data is well known to those skilled in the art of video technology}.

[0048] Additionally, it is possible to ‘stretch’ one of the matrices to generate two matrices of equal size (and calculating interpolated values from the contents of the ‘stretched’ matrix) and then perform the same distance calculations for the different combinations of pixels as described above.

[0049] Referring to FIG. 2, in step 310 an initial combination is made of the matrix representing the original sequence and the matrix representing the degraded sequence. The sum of all the pixel distances for this matrix combination is calculated in step 320 and then stored. If all the possible matrix combinations have not been exhausted then a further matrix combination is chosen and the sum of all the pixel distances is calculated. Once this summation has been made for all of the possible matrix combinations then a comparison is made and the lowest summation value is chosen. The matrix combination which generated this lowest summation value is chosen as the optimal spatial match of the two sequences and this match is returned to step 270.

[0050] Once an approximation of the size and position of the target screen has been found, then the temporal matching process of the synchronisation program can be run. However, if the spatial synchronisation between the two video sequences is lost, then the matching process must be restarted. The flowchart of the temporal matching process is shown in FIG. 3. A number of frames from the original sequence are scaled down to the size of the search window (as determined above) and stored (see 410). For convenience the frames that are scaled down and stored are taken from some known reference point, e.g. the first n (or the last n) frames of the sequence, such that the corresponding part of the degraded sequence can be located approximately. A first frame pointer is set to indicate the start of the original sequence test frames (step 420) and a second frame pointer is set to indicate the start of the degraded sequence test frames (step 430).

[0051] The two frames identified by the first and second frame pointers are then compared to see if the two frames match (step 440). If the frames do match (step 450) then the correlation between the two frames is recorded (step 460), for example the transmission delay between the original sequence test frame and the degraded sequence test frame and the relative position of the test frame in the two sequences to indicate whether the frames have been delivered in the correct order. Then both the first and the second frame pointer are incremented and the matching process (440) is repeated.

[0052] If the compared frames do not match (step 450) then the first frame pointer is incremented to identify the next test frame in the original sequence (step 480) and the matching process (step 440) is repeated. This loop is continued until there is a match between two frames or until the original sequence test frames have been compared with the current degraded test frame. If this occurs then the degraded sequence is missing a frame and this fact is recorded (step 490). Once all of the frames in the degraded sequence have been matched it should be possible to infer which frame (or frames) is (are) missing from the degraded sequence. The first frame pointer is reset to the start of the original sequence test frames and the second frame pointer is incremented to identify the next test frame in the degraded sequence and the matching process can be repeated (step 440).

[0053] The matching process is repeated until all of the test frames from the degraded sequence have been matched.

[0054] Searching for matching frames along the time axis is still a computationally expensive process. In a real time application, the search space could be as large as 2 or 3 seconds of a video sequence, which could represent about 150 frames for both the original and the degraded sequences, depending upon the video signal format. Therefore, further assumptions can be taken to reduce the search space. For instance, the degraded sequence can be assumed to keep the same temporal continuity as the original, i.e. that the system under use can be assumed not to mix the order of the frames.

[0055] Where the video sequence is being transmitted over a network that only provides a “best effort” quality of service, such as the internet, then it may be necessary to repeat the spatial matching process on a periodic basis.

[0056] The inventor has developed a working prototype of the invention for use with a standard Windows NT or Linux workstation, created in Labview, but will be understood that other programming languages or development environments are suitable for implementing the present invention. It is also possible to implement the invention in hardware, using a number of DSPs (digital signal processors). 

1. A method of aligning a first image with a second image, the method comprising the steps of; (i) approximately locating the second image; (ii) scaling the first image to the approximate size of the second image; (iii) positioning the scaled first image over the approximate location of the second image; (iv) generating a measure of fit between the first image and the second image; (v) re-positioning the second image and repeating steps (iv) and (v) to obtain an increased measure of fit value.
 2. A method of aligning a first image with a second image according to claim 1, wherein step (iv) and step (v) are repeated until a threshold measure of fit value is obtained.
 3. A method of aligning a first image with a second image according to claim 1, wherein steps (iii), (iv) & (v) are replaced by: (a) reducing the size of the first image to a size smaller than the approximate size of the second window; (b) positioning the reduced first image within the approximate location of the second image; (c) generating a measure of fit between the reduced first image and the second image; (d) moving the reduced first image to a further position within the approximate location of the second image; steps (c) and (d) being repeated to obtain an increased measure of fit value.
 4. A method of aligning a first image with a second image according to claim 3, wherein steps (c) and (d) are repeated to generate a maximum measure of fit value for that first image size.
 5. A method of aligning a first image with a second image according to claim 4, wherein if the maximum measure of fit value for that first image size does not reach a threshold measure of fit value then the first image is further reduced in size and the maximum measure of fit value generated for that further reduced size.
 6. A method of synchronising a first sequence of images with a second sequence of images, the method comprising the steps of; (a) creating a first index pointer identifying an image in the first sequence of images; (b) creating a second index pointer identifying an image in the second sequence of images; (c) comparing the image identified by the first index pointer with the image identified by the second index pointer; (d) incrementing the first index pointer to identify the subsequent image in the first sequence of images; and (e) repeating steps (c) and (d) until the image identified by the first index pointer matches the image identified by the second index pointer.
 7. A method of aligning both spatially and temporally a first video sequence with a second video sequence, wherein the spatial alignment is according to any of claim 1-5 and the temporal alignment is according to claim
 6. 